PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Appearance Manager >

Programming With the Appearance Manager


SetThemeTextColorForWindow

Sets a window's foreground color to a theme-compliant color.

pascal OSStatus SetThemeTextColorForWindow (
                     WindowPtr window,
                     Boolean isActive,
                     SInt16 depth,
                     Boolean isColorDev);
window
A value of type WindowPtr . Pass a pointer to the window for which to set the text color.
isActive
A value of type Boolean . Pass true if the window is currently active; otherwise, false .
depth
A signed 16-bit integer. Pass the bit depth (in bits per pixel) of the current graphics port.
isColorDev
A value of type Boolean . Set to true to indicate that you are drawing on a color device. Set to false for a monochrome device.
function result
A result code; see Result Codes . If the specified window does not currently have a theme brush associated with its background or if the associated theme brush is not translatable into a text color, SetThemeTextColorForWindow returns an error.
DISCUSSION

The SetThemeTextColorForWindow function determines whether the specified window has a theme brush associated with its background and, if so, applies the correct foreground color given the theme brush, the window's activity state, and the current drawing environment. This foreground color is applied to any text drawn after the call to SetThemeTextColorForWindow . Note that SetThemeTextColorForWindow only applies a custom foreground color when the window has a theme brush associated with it or if the window is a Dialog Manager dialog box. If your window is not managed by the Dialog Manager, you must use the function SetThemeWindowBackground to associate a theme brush with the window before calling SetThemeTextColorForWindow .

For example, you can call SetThemeWindowBackground to associate the active alert background theme brush with a window:

SetThemeWindowBackground (myWindow, kThemeBrushAlertBackgroundActive, true)
// ...
SetThemeTextColorForWindow (myWindow, true, 16, true)

Then, when you call SetThemeTextColorForWindow , the result is that the window's foreground color is automatically set to the color appropriate for an active alert in the specified drawing environment. In this case, the foreground color that the Appearance Manager would use is that corresponding to the theme text color constant kThemeTextColorAlertActive .

VERSION NOTES

Available with Appearance Manager 1.1 and later.


© 1999 Apple Computer, Inc. – (Last Updated 29 April 99)